package utils

import (
	"crypto/tls"
	"fmt"
	"io/ioutil"
	"net/http"
	"strings"
)

// 获取ticket信息

func GetTicket() {
	host := "192.168.56.110"
	port := "8006"
	path := "/api2/json/access/ticket"
	url := "https://" + host + ":" + port + path
	tr := &http.Transport{
		TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
	}
	client := &http.Client{Transport: tr}
	resp, err := client.Post(url, "application/json", strings.NewReader("username=root&password=123456"))
	resp.Header.Add("Content-Type", "application/json")
	if err != nil {
		fmt.Println(err)
	}
	defer resp.Body.Close()
	body, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		fmt.Println(err)

	}
	fmt.Println(body)
}
